<?php

use Doraemon\pockets\constInterface\EsDbFieldsMap;
use Doraemon\service\Event\Es\EsOperateDesigner;
use Doraemon\tools\Log;

/**
 * description
 *
 * @category   设计师&装修公司的基础信息修改同步对应es
 * @package    PSR
 * @subpackage Documentation\API
 * @author     weiyizheng
 * @date       2022/8/31
 * @time       2:30 下午
 */

class EsOperateDesignerAction extends ActionPlugin
{

	public function main()
	{
		Log::info('Es操作设计师信息接收到的订阅消息', $this->messageBody);

		if (!$this->messageBody['table']) throw new \Exception('未获取到数据表');
		if (!$this->messageBody['data']) throw new \Exception('未接收到数据');

		if (in_array($this->messageBody['table'], EsDbFieldsMap::DESIGNER_TABLE_MAP)) EsOperateDesigner::operate($this->messageBody);

		$this->setSuccess();
	}
}